<?
include("../db.php");
include("auth.php");
include("rollerinclude.php");

if (!$_REQUEST['printerfriendly'] == 'true') {
	include("top.php");
	rollermeny();
	echo "<a href=\"alleroller.php?printerfriendly=true\">Utskriftsvennlig</a>";
	echo " (<a href=\"alleroller.php?printerfriendly=true&amp;savespace=true\">ikke gjenta gruppebeskrivelser</a>)\n";
} else {
	?>
	<html>
	<head>
		<title>Rollebeskrivelser</title>
		<style type="text/css">
		BODY {
			font-family: Georgia, serif;
			font-size: 10pt;
		}
		.rolle {
			page-break-after: always;
			text-align: left;
			font-family: Georgia, serif;
			font-size: 10pt;
		}
		TH {
			text-align: left;
		}
		</style>
		<body>
	<?
}

if ($_REQUEST['savespace']=='true')
	$savespace=true;
else
	$savespace=false;

$sql="SELECT * FROM r_Rolle WHERE LaivID=$laivid ORDER BY familienavn, rollenavn";
$roller=mysql_query($sql) or die(mysql_error());

while ($rolle=mysql_fetch_assoc($roller)) {
	if ((! is_null($rolle['familienavn'])) && $rolle['familienavn'] != "")
		echo "<h2>".$rolle['familienavn'].", ".$rolle['rollenavn']."</h2>\n";
	else
		echo "<h2>".$rolle['rollenavn']."</h2>\n";
	
	echo "<div class=\"rolle\">\n";
	completeRollebeskrivelse($rolle['ID'], "", $savespace);
	echo "</div>\n";
}

if ($savespace) {
	echo "<div class=\"rolle\">\n";
	echo "<h2>Gruppekompendier</h2>\n";
	printGrupper($laivid);
	echo "</div>\n";
}

include("bottom.php");
?>
